package lcr;

public class Test0173 {
}

class Solution0173_1 {
    public int takeAttendance(int[] records) {
        int left=0,right=records.length-1;
        while (records[left]==left&&right<records[right]){
            int mid=(left+right)>>1;

            if (mid==records[mid]){
                left=mid+1;
            }else {
                right=mid-1;
            }
        }

        return right==records[right]?right+1:left;
    }
}
